<template>
	<div>
		<el-row>
			<el-tabs type="border-card">
				<el-tab-pane v-for="(item,index) in tab_list" :key="index" :label="item.label">
					<el-row :gutter="1" type="flex" style="margin: 20px 0 ;">
						<el-col :span="5">
							<el-row type="flex">
								<el-col :span="17">
									<el-autocomplete class="inline-input" v-model="state1"
										:fetch-suggestions="querySearch" placeholder="请输入内容" @select="handleSelect">
										<i class="el-icon-edit el-input__icon" slot="suffix">
										</i>
									</el-autocomplete>
								</el-col>
								<el-col :span="5">
									<el-button type="primary">主要按钮</el-button>
								</el-col>
							</el-row>
						</el-col>
					</el-row>
					<el-row>
						<el-table :data="tableData" border style="width: 100%">
							<el-table-column label="Name" prop="id">
							</el-table-column>
							<el-table-column label="phone" prop="name">
							</el-table-column>
							<el-table-column label="address" prop="desc">
							</el-table-column>
							<el-table-column label="wallet" prop="desc">
							</el-table-column>
							<el-table-column label="Completed Number" prop="desc">
							</el-table-column>
							<el-table-column label="StartTime" prop="desc">
							</el-table-column>
							<el-table-column label="UpTime" prop="desc">
							</el-table-column>
							
							
						</el-table>
					</el-row>
					<el-row style="margin: 20px 0 ;" type="flex" justify="center">
						<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
							:current-page.sync="currentPage3" :page-size="100" :hide-on-single-page="true"
							layout="prev, pager, next, jumper" :total="1000" background>
						</el-pagination>
					</el-row>
				</el-tab-pane>
			</el-tabs>
		</el-row>
	</div>
</template>

<script>
	export default {
		data() {
			return {

				currentPage3: 5,

				restaurants: [],
				state1: '',
				state2: '',

				tab_list: [{
					id: 1,
					label: 'User List'
				}],

				tableData: [{
					id: '12987122',
					name: '好滋好味鸡蛋仔',
					category: '江浙小吃、小吃零食',
					desc: '荷兰优质淡奶，奶香浓而不腻',
					address: '上海市普陀区真北路',
					shop: '王小虎夫妻店',
					shopId: '10333'
				}, {
					id: '12987123',
					name: '好滋好味鸡蛋仔',
					category: '江浙小吃、小吃零食',
					desc: '荷兰优质淡奶，奶香浓而不腻',
					address: '上海市普陀区真北路',
					shop: '王小虎夫妻店',
					shopId: '10333'
				}, ]
			}
		},
		mounted() {
			this.restaurants = this.loadAll();


		},
		methods: {

			//分页 上
			handleSizeChange(val) {
				console.log(`每页 ${val} 条`);
			},
			handleCurrentChange(val) {
				console.log(`当前页: ${val}`);
			},
			//分页 下

			// 建议输入 上
			querySearch(queryString, cb) {
				var restaurants = this.restaurants;
				var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants;
				// 调用 callback 返回建议列表的数据
				cb(results);
			},
			createFilter(queryString) {
				return (restaurant) => {
					return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
				};
			},
			handleSelect(item) {
				console.log(item);
			},
			loadAll() {
				return [{
						"value": "三全鲜食（北新泾店）",
						"address": "长宁区新渔路144号"
					},
					{
						"value": "Hot honey 首尔炸鸡（仙霞路）",
						"address": "上海市长宁区淞虹路661号"
					},
					{
						"value": "新旺角茶餐厅",
						"address": "上海市普陀区真北路988号创邑金沙谷6号楼113"
					},
					{
						"value": "泷千家(天山西路店)",
						"address": "天山西路438号"
					},

				];
			},
			// 建议输入 下


		}
	}
</script>

<style>
	.demo-table-expand {
		font-size: 0;
	}

	.demo-table-expand label {
		width: 90px;
		color: #99a9bf;
	}

	.demo-table-expand .el-form-item {
		margin-right: 0;
		margin-bottom: 0;
		width: 50%;
	}
</style>
